package com.nageoffer.shortlink.admin.common.biz.user;

import jakarta.servlet.*;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class ExceptionFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        try {
            filterChain.doFilter(servletRequest,servletResponse);
        }catch (Exception e){
            servletRequest.setAttribute("filter.error",e);
            servletRequest.getRequestDispatcher("/error/exthrow").forward(servletRequest,servletResponse);
        }
    }
}
